<!--继承布局页面-->
@extends('front.common.header')
<!--title-->
@section('title','职场技能 - 充电加油')
    <!--头部导航块-->
@section('head')
    @parent
    @stop

            <!--中间类容块-->
@section('content')
<link rel="stylesheet" type="text/css" href="{{ asset('/css/teaches/charge.css') }}" >
<link rel="stylesheet" type="text/css" href="{{ asset('/css/employ/list.css') }}" />
<div class="charge">
<!--头部-->
    <div class="content">
        <div class='top-nav'>
    		<ul>
    		  {!! $mianbaoxie !!}
    		</ul>
    	</div>
    </div>
    <!--中间类容-->
    <div class="charge-body">
    <!--左边-->
        <div class="charge-left fl">
            <div class="employ-search">
	           <div class="search-line" id="search-line">
	               <ul  class="clearfix">
	                   <li class="fist-title">学习方向：</li>
	                   <li class="list-nav">
	                       <a href="">充电加油</a>
	                   </li>
	                   <li class="">
	                       <a href="{{url('employ/list')}}">就业指南</a>
	                   </li>
	               </ul>
	           </div>
	           <div class="search-line bodertop" id="search-line">
	               <ul class="clearfix">
	                   <li class="fist-title">板块分类：</li>
	                   <li @if($id == 1)class="list-nav"@endif>
	                       <a href="{{url('/teaches/list/1')}}">职场技能</a>
	                   </li>
	                   <li @if($id == 2)class="list-nav"@endif>
	                       <a href="{{url('/teaches/list/2')}}">推荐机构</a>
	                   </li>
	                   <li @if($id == 3)class="list-nav"@endif>
	                       <a href="{{url('/teaches/list/3')}}">企业专区</a>
	                   </li>
	               </ul>
	           </div>

{{--一级分类--}}
                @if(!empty($subcateid))
                        <div class="search-line bodertop">
                            <ul class="clearfix">

                                    <li class="fist-title">全部技能：</li>
                                <li  @if(empty($secondid))class="list-nav"@endif>
                                    <a href="{{url('/teaches/list/1?kw='.$comkeyword)}}">全部</a>
                                </li>
                           @foreach($subcateid as $sub)
                                    <li  @if(($secondid == $sub->cat_id ))class="list-nav"@endif>
                                        <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&sort=0')}}">{{$sub->cat_name}}</a>
                                    </li>
                            @endforeach
                            </ul>
                        </div>
                @endif
{{--二级分类--}}

              {{--  http://local.cimo.cn/teaches/list/1?kw=0&secondid=29&lastid=31&thirdid=117&sort=0--}}
                @if(!empty($secondChild))
                    @foreach($secondChild as $sub)
                        <div class="search-line bodertop">
                            <ul class="clearfix">
                                <li class="fist-title">{{$sub->cat_name}}：</li>
                                <li  @if(($secondid == $sub->cat_id ) && ($lastid == 0 || empty($lastid)))class="list-nav"@endif>
                                    <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&sort=0')}}">全部</a>
                                </li>
                                @foreach($sub->childrenCates as $key=>$child)
                                    @if($key>=7 && $lastid == $child->cat_id)
                                        <li class="list-nav">
                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                        </li>
                                    @endif
                                @endforeach
                                @foreach($sub->childrenCates as $key=>$child)
                                    @if($key < 7)
                                        <li @if($lastid == $child->cat_id)class="list-nav"@endif>
                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                        </li>
                                    @endif
                                    @if($key>=7 && $lastid == $child->cat_id)
                                        <li class="list-nav">
                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                        </li>
                                    @endif
                                @endforeach
                                @if(count($sub->childrenCates)>7)
                                    <div class="float-r has-more position-relative" id="has-more">
                                        <div class="icon-img">
                                            <img src="{{asset('images/front/more.png')}}">
                                        </div>
                                        <div class="search-line to-more-infomation" id="to-more-infomation">
                                            <ul class="clearfix boderbtm-dashed">
                                                <li class="fist-title">{{$sub->cat_name}}：</li>
                                                <li  @if(($secondid == $sub->cat_id ) && ($lastid == 0 || empty($lastid)))class="list-nav"@endif>
                                                    <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&sort=0')}}">全部</a>
                                                </li>
                                                @foreach($sub->childrenCates as $key=>$child)
                                                    @if($key < 7)
                                                        <li @if($lastid == $child->cat_id)class="list-nav"@endif>
                                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                                        </li>
                                                    @endif
                                                    @if($key>=7 && $lastid == $child->cat_id)
                                                        <li class="list-nav">
                                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                                        </li>
                                                    @endif
                                                @endforeach
                                            </ul>
                                            <ul class="clearfix">
                                                @foreach($sub->childrenCates as $key=>$child)
                                                    @if($key >= 7)
                                                        <li @if($lastid == $child->cat_id)class="list-nav"@endif>
                                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                                        </li>
                                                    @endif
                                                @endforeach
                                            </ul>
                                        </div>
                                    </div>
                                @endif
                            </ul>
                        </div>
                    @endforeach
                @endif
{{-- 三级分类--}}
                @if(!empty($thirdChild))
                    @foreach($thirdChild as $sub)
                        <div class="search-line bodertop"  @if(count($sub->childrenCates)==0)style="display: none"@endif>
                            <ul class="clearfix">
                                <li class="fist-title">{{$sub->cat_name}}：</li>

                                  <li  @if(($lastid== $sub->cat_id ) && empty($thirdid))class="list-nav"@endif>
                                      <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->getFatherIds->cat_id.'&lastid='.$sub->cat_id.'&sort='.$sort)}}">全部 </a>
                                  </li>

                                @foreach($sub->childrenCates as $key=>$child)
                                    @if($key>=7 && $thirdid == $child->cat_id)
                                        <li class="list-nav">
                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->getFatherIds->cat_id.'&lastid='.$sub->cat_id.'&thirdid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                        </li>
                                @endif
                                @endforeach


                                @foreach($sub->childrenCates as $key=>$child)
                                    @if($key < 7)
                                        <li @if($thirdid == $child->cat_id)class="list-nav"@endif>
                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->getFatherIds->cat_id.'&lastid='.$sub->cat_id.'&thirdid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                        </li>
                                    @endif
                                    @if($key>=7 && $thirdid == $child->cat_id)
                                        <li class="list-nav">
                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->getFatherIds->cat_id.'&lastid='.$sub->cat_id.'&thirdid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                        </li>
                                    @endif
                                @endforeach


                                @if(count($sub->childrenCates)>7)
                                    <div class="float-r has-more position-relative" id="has-more">
                                        <div class="icon-img">
                                            <img src="{{asset('images/front/more.png')}}">
                                        </div>
                                        <div class="search-line to-more-infomation" id="to-more-infomation">
                                            <ul class="clearfix boderbtm-dashed">
                                                <li class="fist-title">{{$sub->cat_name}}：</li>
                                                <li  @if(($secondid == $sub->cat_id ) && ($lastid == 0 || empty($lastid)))class="list-nav"@endif>
                                                    <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->cat_id.'&sort=0')}}">全部</a>
                                                </li>
                                                @foreach($sub->childrenCates as $key=>$child)
                                                    @if($key < 7)
                                                        <li @if($lastid == $child->cat_id)class="list-nav"@endif>
                                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->getFatherIds->cat_id.'&lastid='.$sub->cat_id.'&thirdid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                                        </li>
                                                    @endif
                                                    @if($key>=7 && $lastid == $child->cat_id)
                                                        <li class="list-nav">
                                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->getFatherIds->cat_id.'&lastid='.$sub->cat_id.'&thirdid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                                        </li>
                                                    @endif
                                                @endforeach
                                            </ul>
                                            <ul class="clearfix">
                                                @foreach($sub->childrenCates as $key=>$child)
                                                    @if($key >= 7)
                                                        <li @if($lastid == $child->cat_id)class="list-nav"@endif>
                                                            <a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$sub->getFatherIds->cat_id.'&lastid='.$sub->cat_id.'&thirdid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                                        </li>
                                                    @endif
                                                @endforeach
                                            </ul>
                                        </div>
                                    </div>
                                @endif
                            </ul>
                        </div>
                        @endforeach
                        @endif

	       </div>
           <div class="employ-search employ-sort mt-15">
            <div class="search-line">
                @if(empty($thirid))
                    <ul class="clearfix">
                        <li class="@if(empty($sort) || $sort ==  0) list-nav @endif"><a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$secondid.'&lastid='.$lastid.'&thirdid='.$thirdid.'&sort=0')}}">综合排序</a></li>
                        <li>|</li>
                        <li class="@if($sort == 1) list-nav @endif"><a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$secondid.'&lastid='.$lastid.'&thirdid='.$thirdid.'&sort=1')}}">浏览人数</a></li>
                        <li>|</li>
                        <li class="@if($sort == 2) list-nav @endif"><a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$secondid.'&lastid='.$lastid.'&thirdid='.$thirdid.'&sort=2')}}">评论人数</a></li>
                        <li>|</li>
                        <li class="@if($sort == 3) list-nav @endif"><a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$secondid.'&lastid='.$lastid.'&thirdid='.$thirdid.'&sort=3')}}">收藏人数</a></li>
                    </ul>
                @else
                    <ul class="clearfix">
                        <li class="@if(empty($sort) || $sort ==  0) list-nav @endif"><a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$secondid.'&lastid='.$lastid.'&sort=0')}}">综合排序</a></li>
                        <li>|</li>
                        <li class="@if($sort == 1) list-nav @endif"><a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$secondid.'&lastid='.$lastid.'&sort=1')}}">浏览人数</a></li>
                        <li>|</li>
                        <li class="@if($sort == 2) list-nav @endif"><a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$secondid.'&lastid='.$lastid.'&sort=2')}}">评论人数</a></li>
                        <li>|</li>
                        <li class="@if($sort == 3) list-nav @endif"><a href="{{url('/teaches/list/1?kw='.$comkeyword.'&secondid='.$secondid.'&lastid='.$lastid.'&sort=3')}}">收藏人数</a></li>
                    </ul>

                @endif



             </div>
            </div>
            <div class="charge-l-three mt-20">

            @foreach($teaches as $teach)    
                <div class="charge-three fl">
                    <div class="charge-three-img">
                        <a href="{{url('/teaches/'.$teach->id)}}">
                           <img src="{{count($teach->attachment)>0?image_resize($teach->attachment->url,218,132):asset('/images/t-nopic.jpg')}}" width="218" height="132">
                        </a>
                    </div>
                    <div><a href="{{url('/teaches/'.$teach->id)}}"><span class="introduction">{{ str_limit($teach->name, 24) }}</span></a></div>
                    <ul class="charge-three-tp" style="margin:0;padding:0">
                        <li class="fl" style="width:50%">
                            <img src="{{asset('images/front/neweye.png')}}" style="margin-top:2px;">
                            &nbsp;&nbsp;{{$teach->views_num?:0}}
                        </li>
                        <li class="fl" style="width:50%">
                            <img src="{{asset('/images/front/newchat.png')}}" style="margin-top:2px;">
                            &nbsp;&nbsp;{{$teach->comments_num}}
                        </li>
                    </ul>
                     <ul class="" style="margin-top:2px">
                        @if($teach->price==0)
                        <li class="mf fl">免费</li>
                        @else
                        <li class="mf fl" style="color:orange">{{$teach->price?:'免费'}}</li>
                        @endif
                        <li class="fl" style="margin-left:10px">|</li>
                        <li class="bgrj fl">{{$teach->categorys->cat_name}}</li>
                    </ul>
                     <div class="clearfix"></div> 
                </div> 
            @endforeach
            </div>
               <div class="charge-foot fl">
                   @if($teaches_num > 12)
                    <div class="charge-footer">
                        <a href="javascript:void(0);" id="getMores">继续加载.....</a>
                        <input type="hidden" name="pages" value="{{$pages}}" />
                    </div>   
                   @else
                   <div class="charge-footer">
                        <a href="javascript:void(0);" id="getMores">没有更多数据</a>
                        <input type="hidden" name="pages" value="{{$pages}}" />
                    </div>   
                   @endif
                </div>
        </div>
       <script>
        $(function(){
            $('#getMores').click(function(){
                var p = $("input[name=pages]").val();
                var secondid = "{{ Input::get('secondid')}}";
                var lastid = "{{ Input::get('lastid')}}";
                var sort = "{{Input::get('sort',0)}}";
                var thirdid="{{Input::get('thirdid',0)}}";
                $.ajax({
                    type:'GET',
    	            url:'/teaches/list/1',
    	            data:"page="+p+"&kw="+'{{$comkeyword}}'+"&secondid="+secondid+"&lastid="+lastid+"&thirdid="+thirdid+'&sort='+sort,
    	            dataType:'json',
                    success:function(data){
                        if(data.status == 'success'){
                            var result = data.data;
                            var str = '';
                            var html = '';
                            $.each(result,function(k,e){
                                if(e.price > 0){
                                	html = '<li class="mf fl" style="color:orange">'+e.price+'</li>';
                                }else{
                                	html = '<li class="mf fl">免费</li>';
                                }
                                var thumburl ="";
                                if(e.attachment!= 'undefined' && e.attachment != '' && e.attachment != null){
									thumburl = e.attachment.url;
                                }else{
									thumburl = '/images/t-nopic.jpg';
                                }
                                var sname = e.name;
                                if(sname.length > 12){
                                	sname = sname.substring(0,12)+"...";
                                }
                                str += '<div class="charge-three fl">'
                                       +'     <div class="charge-three-img">'
                                       +'         <a href="/teaches/'+e.id+'">'
                                       +'          <img src="'+thumburl+'" style="width:218px;height:136px">'
                                       +'       </a>'
                                       +'   </div>'
                                       +'   <div><a href="/teaches/'+e.id+'"><span class="introduction">'+sname+'</span></a></div>'
                                       +'   <ul class="charge-three-tp" style="margin:0;padding:0">'
                                       +'       <li class="fl" style="width:50%">'
                                       +'           <img src="/images/front/neweye.png" style="margin-top:2px;">&nbsp;&nbsp;'
                                       +			e.views_num            
                                       +'       </li>'
                                       +'       <li class="fl" style="width:50%">'
                                       +'           <img src="/images/front/newchat.png" style="margin-top:2px;">&nbsp;&nbsp;'
                                       +			e.comments_num
                                       +'       </li>'
                                       +'   </ul>'
                                       +'    <ul class="" style="margin-top:2px">'
                                       +html
                                       +'		<li class="fl" style="margin-left:10px">|</li>'
                                       +'         <li class="bgrj fl">'+e.categorys.cat_name+'</li>'
                                       +'     </ul>'
                                       +'      <div class="clearfix"></div> '
                                       +' </div>';
                            });
                            $("input[name=pages]").val(data.pages);
    	                    $('.charge-l-three').append(str);
                        }else{
                            $("#getMores").html(data.msg);
                        }
                    }
                });
            });
        })
    </script>
    <!--右边-->    
        <div class="charge-right fr">
           <span class="rmtj">热门推荐</span>  
           @foreach($recommendTeaches as $vo)
           <div class="charge-r">
               <span style="width:218px;height:136px">
                   <a href="{{url('/teaches/'.$vo->id)}}">
                   <img src="@if(count($vo->attachment)>0){{$vo->attachment->url}}@else{{asset('/images/t-nopic.jpg')}}@endif" width="218" height="136">
                   </a>
               </span>               
               <a href="{{url('/teaches/'.$vo->id)}}"><span class="charge-r-sm">{{$vo->name}}</span></a>
               <ul>
                   @if($vo->price)<li class="mfxl fl" style="color: #3ba800"> {{$vo->price}} @else<li class="mf fl color-11">免费@endif</li>
                   <li  class="fl">|</li>
                   <li  class="fl">@if(count($vo->categorys)>0){{$vo->categorys->cat_name}}@endif</li>
               </ul>
           </div>
           @endforeach
        </div>
    </div>
</div>
@stop
    
@section('footer')
    @parent
@stop